#include "SSGeneralStatistics.h"

double AfxCorrelation(CSSGeneralStatistics& m1, CSSGeneralStatistics& m2) {
  return Correlation(m1.GetStatistics(), m2.GetStatistics());
}

double AfxCovariance(CSSGeneralStatistics& m1, CSSGeneralStatistics& m2) {
  return Covariance(m1.GetStatistics(), m2.GetStatistics());
}

CSSGeneralStatistics::CSSGeneralStatistics(std::vector<double>& samples) {
  m_pStatics = new GeneralStatistics(samples);
}

CSSGeneralStatistics::CSSGeneralStatistics(void) {
  m_pStatics = new GeneralStatistics();
}

CSSGeneralStatistics::~CSSGeneralStatistics(void) {
  if (m_pStatics) delete m_pStatics;
  m_pStatics = NULL;
}

std::size_t CSSGeneralStatistics::Samples() const {
  return m_pStatics->Samples();
}

void CSSGeneralStatistics::Add(double value, double weight) {
  return m_pStatics->Add(value, weight);
}

const std::vector<std::pair<double, double> >& CSSGeneralStatistics::Data()
    const {
  return m_pStatics->Data();
}

double CSSGeneralStatistics::WeightSum() const {
  return m_pStatics->WeightSum();
}

double CSSGeneralStatistics::Mean() const { return m_pStatics->Mean(); }

double CSSGeneralStatistics::Variance() const { return m_pStatics->Variance(); }

double CSSGeneralStatistics::StandardDeviation() const {
  return m_pStatics->StandardDeviation();
}

double CSSGeneralStatistics::Min() const { return m_pStatics->Min(); }

double CSSGeneralStatistics::Max() const { return m_pStatics->Max(); }

int CSSGeneralStatistics::GetDistributionInfo(
    std::vector<DistributionInfo>& distInfoVec,
    std::vector<NormalCurvePoint>& normalCurvePoints, int nPoints) {
  return m_pStatics->GetDistributionInfo(distInfoVec, normalCurvePoints,
                                         nPoints);
}
